<!DOCTYPE html>
<#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
<#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
<html>
<head>
    <meta charset="utf-8">
    <title>质量信得过职工管理基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/forms/currencyCss.css">
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .qbdms-TBinformation {
            margin-left: 0;
            font-size: 15px
        }
    </style>
</head>
<body class="listBody">
<div class="qbdms-bodyDiv">
    <div class="qbdms-backDiv">
        <div class="layui-table-view-body" style="padding: 0 24px 24px;">
            <div class="qbdms-formTitle" style="border-bottom: 1px solid #E5F0FF">质量信得过职工信息 <i class="qbdms-returnOn closeWindow" id="back">返回</i></div>
            <form class="layui-form treeFormPreview" requrl="${ctx}/qbdms/wQbdTrustPeople/get" lay-filter="wQbdTrustPeopleDataForm" id="wQbdTrustPeopleDataForm">
                <@fillDept.dept id="tbxx"/>
                <div class="layui-row">
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="密级">密级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@secSelect.sec_select data_src=1 required=true name="secret"/>
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="姓名">姓名<span style="color: red;">*</span></label>
                        <button type="button" class="layui-btn qbdms-twoBtn" id="selectTrustPeopleBtn" style="float: right">选择</button>
                        <div class="layui-input-block qbdms-input qbdms-inputIsButton">
                            <input type="text" placeholder="请选择" autocomplete="off" class="layui-input textInput" lay-verify="required" lay-reqtext="姓名是必填项" name="userName" maxlength="50" readonly>
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="性别">性别<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="sex" nodeKey="xb" css="layui-input textInput" verify="required" reqtext="性别是必填项" />
                        </div>
                    </div>

                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="单位">单位<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" name="company" placeholder="自动带入" autocomplete="off" class="layui-input textInput isReadonlyInput" maxlength="50" lay-verify="required" lay-reqtext="单位是必填项" readonly>
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="工作岗位">工作岗位<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="station" nodeKey="gzgw" css="layui-input textInput" verify="required" reqtext="工作岗位是必填项" />
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="职务">职务<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="job" nodeKey="zw" css="layui-input textInput" verify="required" reqtext="职务是必填项" />
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="年度">年度<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" name="years" placeholder="请选择" autocomplete="off" class="layui-input" id="years" maxlength="50" fieldname="years" lay-verify="required" lay-reqtext="年度是必填项" readonly>
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="季度">季度<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="quarter" nodeKey="jd" css="layui-input textInput" verify="required" reqtext="季度是必填项" />
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="申报类别">申报类别<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="kind" nodeKey="sblb" css="layui-input textInput" verify="required" reqtext="申报类别是必填项" />
                        </div>
                    </div>
                    <div style="width: 50%">
                        <label class="layui-form-label qbdms-label" title="申报类别">等级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="awardlevel" nodeKey="dj" css="layui-input textInput" verify="required" reqtext="等级是必填项" />
                        </div>
                    </div>
                    <div style="width: 76%">
                        <label class="layui-form-label qbdms-label" title="申报理由（简述）">申报理由（简述）</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea type="text" name="reason" placeholder="请输入" autocomplete="off" class="layui-input" maxlength="160" style="min-height:64px;padding-top: 5px"></textarea>
                        </div>
                    </div>
                    <div style="width: 76%">
                        <label class="layui-form-label qbdms-label" title="详细描述">详细描述</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea type="text" name="detailDescribe" placeholder="请输入" autocomplete="off" class="layui-input" maxlength="160" style="min-height:64px;padding-top: 5px"></textarea>
                        </div>
                    </div>
                    <div style="width: 76%">
                        <label class="layui-form-label qbdms-label" title="备注">备注</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea type="text" name="remark" placeholder="请输入" autocomplete="off" class="layui-input" maxlength="160" style="min-height:64px;padding-top: 5px"></textarea>
                        </div>
                    </div>
                </div>
                <div class="layui-hide">
                    <input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input  textInput" maxlength="50" fieldname="id">
                    <input type="text" name="userAccount" placeholder="请输入" autocomplete="off" class="layui-input  textInput" maxlength="50" fieldname="userAccount">
                    <input type="text" name="companyCode" placeholder="请输入" autocomplete="off" class="layui-input  textInput" maxlength="50" fieldname="companyCode">
                </div>
                <div class="layui-form-item btnformItem">
                    <p style="text-align: left;padding-left: 246px">
                        <span id="hideAndShow" style="display: none;">
                            <a lay-submit lay-filter="wQbdTrustPeople" class="layui-btn btn-n privateSubmit qbdms-oneBtn" requrl="${ctx}/qbdms/wQbdTrustPeople/save" id="urlFormSave">保存</a>
                            <a lay-filter="wProblemresetMsg" id="run" class="layui-btn btn-n qbdms-oneBtn">启动</a>
                            <button type="reset" id="closeWindow" style="margin-left: 10px;" class="layui-btn layui-btn-sm qbdms-oneBtnLine closeWindow">取消</button>
                        </span>

                    </p>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    var vaildFlag ;
    var runFlag=false;
    var flowStatus="${flowStatus}";
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'layer', 'upload', 'common', 'propsHandle', 'jquery', 'publicMethods', 'qbdmsForm', 'commonDialog'], function () {
        var laydate = layui.laydate;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var upload = layui.upload;
        var setter = layui.setter;
        var form = layui.qbdmsForm;
        var commonDialog = layui.commonDialog;
        var propsHandle = layui.propsHandle;
        var defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        //年选择器
        laydate.render({
            elem: '#years'
            , type: 'year'
            , trigger: 'click'
        });
        form.verify({
            length100:[/^.{0,100}$/,'输入字符数不能超过100'],
            length2000:[/^.{0,2000}$/,'输入字符数不能超过2000'],
            money: function (value, item) {
                if (value && !new RegExp(/^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*)|0)$/).test(value)) {
                    return common.verifyTitleAdd(item) + "请输入数字且小数最多两位";
                }
            }
        });

        vaildFlag = false;
        $("#urlFormSave").click(function () {
            //- 添加表单验证规则 开始 ---------------------------------------------------------------------
            form.verify({
                length100:[/^.{0,100}$/,'输入字符数不能超过100'],
                length2000:[/^.{0,2000}$/,'输入字符数不能超过2000'],
                money: function (value, item) {
                    if (value && !new RegExp(/^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*)|0)$/).test(value)) {
                        return common.verifyTitleAdd(item) + "请输入数字且小数最多两位";
                    }
                }
            });
            //- 添加表单验证规则 结束 ---------------------------------------------------------------------
            vaildFlag=form.VerifyForm("wQbdTrustPeopleDataForm");
        });

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdTrustPeople/view/list';
        });

        if(flowStatus == null || flowStatus == 0|| flowStatus==99){
            $("#hideAndShow").show();
        }else{
            $("#back").hide();
        }
        if(flowStatus==99){
            $("#run").hide();
        }

        var id = "${id}";
        common.updateForm({
            name: 'wQbdTrustPeopleDataForm',
            idValue: "${id}",
            primary: "id",
            getCallback: function (data) {
                $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
            },
            updateCallback: function (data) {
                if((flowStatus==0||flowStatus==""||null==flowStatus)&&runFlag==true){
                    run(data.data.id);
                }
                if (publicMethods._filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    if((flowStatus=="0" || flowStatus==null||flowStatus==""||flowStatus=="99")&&runFlag==false) {
                        layer.alert(publicMethods.confirmStyle(data.msg),
                            {title: false, skin: 'confirm-class'}, function (index) {
                                layer.close(index);
                                window.location.href = '${ctx}/qbdms/wQbdTrustPeople/view/list';
                            });
                    }
                } else {
                    if((flowStatus=="0" || flowStatus==null||flowStatus==""||flowStatus=="99")&&runFlag==false) {
                        layer.alert(publicMethods.confirmStyle(data.msg),
                            {title: false, skin: 'confirm-class'}, function (index) {
                                layer.close(index);
                                window.location.href = '${ctx}/qbdms/wQbdTrustPeople/view/list';
                            });
                    }
                }
                runFlag=false;
                return false;
            }
        });

        //-- 人员单位选择器 开始 --------------------------------------------------------------
        $("#selectTrustPeopleBtn").click(function () {
            var paramValueString = "";
            commonDialog.CommonDialog("ryswxzq", function (data, selectIds) {
                var dataObj = JSON.parse(data);
                var fullname = dataObj.FULLNAME,
                    uid = dataObj.USERID,
                    dept = dataObj.ORGNAME,
                    deptId = dataObj.CODE;
                //对象赋值
                $("input[name='userName']").val(fullname);
                $("input[name='userAccount']").val(uid);
                $("input[name='company']").val(dept);
                $("input[name='companyCode']").val(deptId);
            }, paramValueString);
        });
        //-- 人员单位选择器 结束 --------------------------------------------------------------

        publicMethods.bottomFixd()
        form.on('select', function (data) {
            publicMethods.bottomFixd()
        });
        form.render();

        $("#run").click(function () {
            var flag=form.VerifyForm("wQbdTrustPeopleDataForm");
            if(flag==false){
                return false;
            }
            runFlag=true;
            $("#urlFormSave").click();
        })
        function run(id) {
            var id = id;
            var userName = $("input[name='userName']").val();
            var userAccount = $("input[name='userAccount']").val();
            var company = $("input[name='company']").val();
            var companyCode = $("input[name='companyCode']").val();
            var kind = $("input[name='kind']").val();
            var station = $("input[name='station']").val();
            var job = $("input[name='job']").val();
            var years = $("input[name='years']").val();
            var quarter = $("input[name='quarter']").val();
            var reason = $("input[name='reason']").val();
            var remark = $("input[name='remark']").val();
            var sex = $("input[name='sex']").val();
            var detailDescribe = $("input[name='detailDescribe']").val();
            var fillman = $("input[name='fillman']").val();
            var fillmanaccount = $("input[name='fillmanaccount']").val();
            var filldept = $("input[name='filldept']").val();
            var filldeptid = $("input[name='filldeptid']").val();
            var filldepthospital = $("input[name='filldepthospital']").val();
            var filldepthospitalid = $("input[name='filldepthospitalid']").val();
            var belongdeptname = $("input[name='belongdeptname']").val();
            var filldate = $("input[name='filldate']").val();
            var secret = $("input[name='secret']").val();
            var tenantId = $("input[name='tenantId']").val();
            var createBy = $("input[name='createBy']").val();
            var createTime = $("input[name='createTime']").val();
            var updateBy = $("input[name='updateBy']").val();
            var updateTime = $("input[name='updateTime']").val();
            var reportStatus = $("input[name='reportStatus']").val();
            var reportReason = $("input[name='reportReason']").val();
            var reportStatusTemp = $("input[name='reportStatusTemp']").val();
            var returnmsg = $("input[name='returnmsg']").val();
            var reportDate = $("input[name='reportDate']").val();
            var awardlevel = $("input[name='awardlevel']").val();
            var flowStatus = $("input[name='flowStatus']").val();
            var nowData = {"id": id,"userName": userName,"userAccount": userAccount,"company": company,"companyCode": companyCode,"kind": kind,"station": station,"job": job,"years": years,"quarter": quarter,"reason": reason,"remark": remark,"sex": sex,"detailDescribe": detailDescribe,"fillman": fillman,"fillmanaccount": fillmanaccount,"filldept": filldept,"filldeptid": filldeptid,"filldepthospital": filldepthospital,"filldepthospitalid": filldepthospitalid,"belongdeptname": belongdeptname,"filldate": filldate,"secret": secret,"tenantId": tenantId,"createBy": createBy,"createTime": createTime,"updateBy": updateBy,"updateTime": updateTime,"reportStatus": reportStatus,"reportReason": reportReason,"reportStatusTemp": reportStatusTemp,"returnmsg": returnmsg,"reportDate": reportDate,"awardlevel": awardlevel,"flowStatus": flowStatus};
            $.ajax({
                url:"${ctx}/qbdms/wQbdTrustPeople/run",
                type: "post",
                dataType: 'json',
                contentType : 'application/json',
                data: JSON.stringify(nowData),
                success : function (data) {
                    if (common.filterRecord(data)) {
                        layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.location.href = '${ctx}/qbdms/wQbdTrustPeople/view/list';
                        });
                    } else {
                        layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.location.href = '${ctx}/qbdms/wQbdTrustPeople/view/list';
                        });
                    }
                    return false;
                },
                error : function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.alert(publicMethods.confirmStyle("内容已保存，启动失败"), {title: false, skin: 'confirm-class'}, function (index) {
                        layer.close(index);
                        window.location.href = '${ctx}/qbdms/wQbdProblemHandle/view/list';
                    });
                }
            })
        }

    });
</script>
</body>
</html>